package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Appconfig struct {
	Mysql
	Redis
}
type Mysql struct {
	Host     string
	Port     int
	User     string
	Password string
}
type Redis struct {
	Host     string
	Port     int
	Password string
}

var Appconf *Appconfig

func Init() {
	var err error
	viper.SetConfigFile("appconfig/dev.yaml")
	viper.ReadInConfig()
	if err != nil {
		panic(err)
	}
	viper.Unmarshal(&Appconf)
	fmt.Println("文件配置成功", Appconf)
}
